package com.controller;



import com.common.utils.PageUtils;
import com.common.utils.R;
import com.entity.FillQuestionEntity;
import com.service.FillQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;

/**
 * 填空题题库
 *
 * @author lxl
 * @email lixialang007@163.com
 * @date 2021-09-08 21:36:19
 */
@RestController
@RequestMapping("exam/fillquestion")
public class FillQuestionController {
    @Autowired
    private FillQuestionService fillQuestionService;

    /**
     * 列表
     */
    @RequestMapping("/list")
//    @RequiresPermissions("exam:fillquestion:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = fillQuestionService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
//   @RequiresPermissions("exam:fillquestion:info")
    public R info(@PathVariable("id") Integer id){
		FillQuestionEntity fillQuestion = fillQuestionService.getById(id);

        return R.ok().put("fillQuestion", fillQuestion);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
//  @RequiresPermissions("exam:fillquestion:save")
    public R save(@RequestBody FillQuestionEntity fillQuestion){
		fillQuestionService.save(fillQuestion);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
//    @RequiresPermissions("exam:fillquestion:update")
    public R update(@RequestBody FillQuestionEntity fillQuestion){
		fillQuestionService.updateById(fillQuestion);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
//    @RequiresPermissions("exam:fillquestion:delete")
    public R delete(@RequestBody Integer[] ids){
		fillQuestionService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
